package com.codes.core.common.enumtype.wordtpl;

/****
 * @Description   案件类型 对应的 案件模板路径
 * @Date 2020/7/4 15:03
 * @Created by peanut
 */
public enum TplUrlEnum {


    /**
     *
     1 载质量 2 几何 3 年检
     4 动态监控 5 改装 6 环保
     7 线路
     */
    //模板对应的路径  \template\word\dongtaijiankong
    zaizhiliang(1,"/template/word/zaizhiliangchaoxian/"), // zaizhiliangchaoxian
    jihe(2,"/template/word/zaizhiliangchaoxian/"),
    nianjian(3,"/template/word/nianjian/"),
    jiankong(4,"/template/word/dongtaijiankong/"),
    gaizhuang(5,"/template/word/zaizhiliangchaoxian/"),
    huanbao(6,"/template/word/zaizhiliangchaoxian/"),
    xianlu(7,"/template/word/xianluweigui/"),
    zhongdaanjian(8,"/template/word/zhongdaanjian/"),

    end(999999 ,"最后的莫西干人");



    /** code */
    private int code;

    /** 显示标签 */
    private String label;

    /**
     * 构造器，必须私有
     * @param code
     */
    TplUrlEnum(int code, String label){
        this.code = code;
        this.label = label;
    }

    /**
     * 获取code的文本
     * @param code
     * @return
     */
    public static String getLabelByCode (int code){
        for (TplUrlEnum enuma : TplUrlEnum.values()){
            if (enuma.getCode() == code){
                return enuma.getLabel();
            }
        }
        return "未知枚举项";
    }
    /**
     * 根据文本获取code
     */
    public static int getCodeByLabel(String label){
        for(TplUrlEnum enuma : TplUrlEnum.values()){
            if(enuma.getLabel().equals(label)){
                return enuma.getCode();
            }
        }
        return -1;

    }

    /**
     * 根据code获取枚举
     */
    public static TplUrlEnum getRoleByCode(int code){
        for(TplUrlEnum enuma : TplUrlEnum.values()){
            if(enuma.getCode() == code){
                return enuma;
            }
        }
        return null;
    }

    public String toString(){
        return label;
    }

    public String getLabel() {
        return label;
    }

    public int getShort(){
        return this.code;
    }

    public int getCode(){
        return this.code;
    }


}
